package com.batchengine.worker;

import static com.batchengine.util.LoggingFactory.createLogger;
import org.apache.log4j.Logger;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * Created by sunil.incubator@yahoo.com.
 * User: sunil.kalva
 * Date: Jun 29, 2009
 */
public abstract class WorkSelector<T> {

    private static final Logger logger = createLogger();
    private BlockingQueue<T> workQ = new LinkedBlockingQueue<T>();

    protected WorkSelector() {
    }

    public BlockingQueue<T> getWorkQ() {
        return workQ;
    }

    public void addToQ(T t) {

        workQ.add(t);
    }

    protected long getTotalWorkSize() {
        return workQ.size();
    }

    public abstract boolean fillWork() throws InterruptedException;

}
